package ai.people.netmon.framework.domain.system.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.people.core.validator.annotation.NumberStatusValue;
import com.people.core.validator.group.AddGroup;
import com.people.core.validator.group.UpdateGroup;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.time.LocalDateTime;

/**
 * @author yuanqinglong
 * @date 2022/3/22 11:31
 */
@Data
@TableName("nm_sys_roles")
public class NmSystemRole {


    /**
     * id
     * @mock 2
     */
    @TableId
    @NotNull(groups = {UpdateGroup.class}, message = "角色id不可为空")
    @Null(groups = {AddGroup.class}, message = "角色id非法")
    @JSONField(serializeUsing = ToStringSerializer.class)
    private Long id;

    /**
     * 父id
     * @mock 1
     */
    @NotNull(message = "父级id为空")
    @JSONField(serializeUsing = ToStringSerializer.class)
    private Long parentId;

    /**
     * 名字
     * @mock 管理员
     */
    @NotEmpty(message = "角色名称为空")
    private String name;

    /**
     * 代码
     */
    @NotEmpty(message = "code为空")
    private String code;

    /**
     * 启用状态 0:不可用，1:可用
     * @mock 1
     */
    @NumberStatusValue(values = {0, 1}, message = "启用状态错误")
    private Integer isEnable;

    /**
     * 创建用户id
     * @ignore
     */
    @JSONField(serializeUsing = ToStringSerializer.class)
    private Long createUserId;

    /**
     * 角色描述
     * @mock 管理员角色-有全部权限
     */
    private String roleDesc;

    /**
     * 创建时间
     * @ignore
     */
    @JSONField(format = "yyyy-MM-dd hh:mm:ss")
    private LocalDateTime createTime;

    /**
     * 修改时间
     * @ignore
     */
    @JSONField(format = "yyyy-MM-dd hh:mm:ss")
    private LocalDateTime updateTime;
}
